Public Partial Class FrmListadoProveedor
    Inherits System.Web.UI.Page
    Public Proveedor As CapaDeNegocios.nProveedor = New CapaDeNegocios.nProveedor
    Dim IdProveedor As String
    Dim DescripcionProveedor As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("Login") = "Anonimo" Then
            Response.Redirect("/")
        End If
        If Not Page.IsPostBack Then
            IdProveedor = Request.QueryString("ID")
            DescripcionProveedor = Request.QueryString("Descripcion")
            LLenarGridProveedor()
            IdProveedor = Request.QueryString("ID")
            DescripcionProveedor = Request.QueryString("Descripcion")
        End If
    End Sub
    Sub LLenarGridProveedor()
        GridProveedor.DataSource = Proveedor.Listar("", "", "", "", "", "", "", "")
        GridProveedor.DataBind()
    End Sub

    Protected Sub GridProveedor_RowDataBound(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridProveedor.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim a As LinkButton = e.Row.FindControl("LinkSeleccionar")
            Dim b As HiddenField = e.Row.FindControl("HFProveedor")
            Dim c As Label = e.Row.FindControl("LblRazonSocial")
            a.OnClientClick = "javascript:window.opener.document.getElementById('" + IdProveedor + "').value = '" + b.Value.ToString() + "';window.opener.document.getElementById('" + DescripcionProveedor + "').value = '" + c.Text + "';window.close();"
        End If
    End Sub


    Protected Sub GridProveedor_PageIndexChanging(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridProveedor.PageIndexChanging
        GridProveedor.PageIndex = e.NewPageIndex
        LLenarGridProveedor()
    End Sub
End Class